import axios from '../../utils/myAixos'
import "./add.css"
import { Button, Form, Input, Radio,  Select } from 'antd';
import { LeftOutlined } from '@ant-design/icons';
const Add = () => {

  const back = () => {
    window.history.back(-1)
  }
  // const { TextArea } = Input;
  const onFinish = (values) => {
    console.log('Finish:', values);
    // let myForData = new FormData()//传图片数据
    // myForData.append('Finish', values)
    // myForData.append('v_name', values.v_name)
    // myForData.append('v_phone', values.v_phone)
    // myForData.append('v_address', values.v_address)
    // myForData.append('v_email', values.v_email)
    // myForData.append('v_status', values.v_status)
    // console.log(myForData)
    axios({
      url: 'venueAdd',
      method:'post',
      data:values
    }).then(res =>{
      console.log('添加数据',res)
      if(res.status === 200){
        console.log('添加成功')
        window.history.back(-1)
      }else{
        console.log('上传失败')
      }
    }).catch(err =>{
      console.log('添加失败',err)
    })
  }

  // const options = [
  //   {
  //     value: '福州',
  //     label: '福州',

  //   },
  //   {
  //     value: '江苏',
  //     label: '江苏',

  //   },
  // ];
  return (
    <div className="body1">
      <div className="header1">
        <span>场馆添加</span>
        <span className="btn" onClick={back}>
          {/* <Space> */}
          <LeftOutlined />
          {/* </Space> */}
          返回</span>
      </div>
      <div className='body11'>
        <Form
          name="basic"
          labelCol={{ span: 8 }}
          wrapperCol={{ span: 16 }}
          onFinish={onFinish}
          style={{ maxWidth: 600 }}
          initialValues={{ remember: true }}
          autoComplete="off"
        >
          <Form.Item
            label="场馆名称"
            name="v_name"
            rules={[{ required: true, message: '请输入内容!' }]}
          >
            <Input placeholder="符号健身馆" />
          </Form.Item>
          

          <Form.Item
            label="电话"
            name="v_phone"
            rules={[{ required: true, message: '请输入内容' }]}
          >
            <Input placeholder="13333333333" />
          </Form.Item>
          <Form.Item className="dv"
            label="地址"
            name="v_address"
            rules={[{ required: true, message: '请输入内容!' }]}
          >
            <Select style={{width:'200px'}}>
              <option value="福州">福州</option>
              <option value="江苏">江苏</option>
              <option value="北京">北京</option>
            </Select>
          </Form.Item>
          
          <Form.Item 
            label="课程类型"
            name="v_classname"
            rules={[{ required: true, message: '请输入内容!' }]}
          >
            <Select style={{width:'400px'}}>
              <option value="极速减脂">极速减脂</option>
              <option value="瑜伽教学">瑜伽教学</option>
              <option value="举重练习">举重练习</option>
              <option value="卧推训练">卧推训练</option>
            </Select>
          </Form.Item>
          <Form.Item
            label="最大人数"
            name="v_number"
            rules={[{ required: true, message: '请输入内容!' }]}
          >
            <Input placeholder="100" />
          </Form.Item>
          <Form.Item
            label="任课教练"
            name="v_teacher"
            rules={[{ required: true, message: '请输入内容!' }]}
          >
            <Input placeholder="" />
          </Form.Item>
          <Form.Item className="dv"
            label="任课时段"
            name="v_time"
            rules={[{ required: true, message: '请输入内容!' }]}
          >
            <Select style={{width:'200px'}}>
              <option value="19:00 - 19:45">19:00 - 19:40</option>
              <option value="20:00 - 20:40">20:00 - 20:40</option>
              <option value="21: - 21:40">21: - 21:40</option>
            </Select>
          </Form.Item>
          <Form.Item
            label="邮箱"
            name="v_email"
            rules={[{ required: true, message: '请输入内容!' }]}
          >
            <Input placeholder="123@123.com" />
          </Form.Item>
          <Form.Item
            label="状态"
            name="v_status"
            rules={[{ required: true, message: '状态不能为空' }]}
          >
            <Radio.Group name="radiogroup" defaultValue={1} style={{ display: "flex", }}>
              <Radio value={true}>启用</Radio>
              <Radio value={false}>禁用</Radio>
            </Radio.Group>
          </Form.Item>

          {/* <Form.Item
            label="介绍"
            
          >
            <>
              <TextArea rows={4} placeholder="场馆介绍" maxLength={6} />
            </>
          </Form.Item> */}

          {/* <Form.Item
            label="是否默认场馆"
            name="是否默认场馆"
            rules={[{ required: true, message: 'Please input your password!' }]}
          >
            <Radio.Group name="radiogroup" defaultValue={1} style={{ display: "flex", }}>
              <Radio value={1}>是</Radio>
              <Radio value={2}>否</Radio>
            </Radio.Group>
          </Form.Item> */}


          {/* <Form.Item name="remember" valuePropName="checked" wrapperCol={{ offset: 8, span: 16 }}>
            <Checkbox>Remember me</Checkbox>
          </Form.Item> */}

          <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
            <Button type="primary" htmlType="submit" >
              提交
            </Button>
          </Form.Item>
        </Form>
      </div>
    </div>
  );
};
export default Add;
